package com.gaojunxiang.controller.interceptor;

import com.gaojunxiang.controller.result.Result;
import com.gaojunxiang.system.exception.BusinessException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Component
@ControllerAdvice
public class ProjectException {
     @ExceptionHandler(BusinessException.class)
     @ResponseBody
     public Result doBusinessException(BusinessException e){
        return new Result(e.getCode(),e.getMessage());
     }
}
